#ifndef PAGEBRAKE_H
#define PAGEBRAKE_H

#include <QWidget>
#include <QLabel>
#include "global_def.h"

namespace Ui {
class PageBrake;
}

class PageBrake : public QWidget
{
    Q_OBJECT

public:
    explicit PageBrake(QWidget *parent = nullptr);
    ~PageBrake();
    enum{
        BrkStat_MainRes,
        BrkStat_AirSuspPress,
        BrkStat_BCPB,
        BrkStat_LocWeight,
        BrkStat_Master,
        BrkStat_PBPress,
        BrkStat_HoldBrk,
        BrkStat_LoadFactor
    };
    void setBrkStat(uint8_t item, uint8_t index, uint16_t value);
private:
    Ui::PageBrake *ui;
    QList<QList <QLabel *>> m_lBrkStatList;
    QStringList m_lBrkStatNameList;
    QList<uint8_t> m_lBrkStatCntOfOneCar;
private:
    void InitBrkStatLabels();
    void setDefaultBrkStat();
    void SetPosition(QWidget* w, int car, uint8_t row, uint8_t col, uint8_t total, bool xReverse=false);
private:
    int m_nStatLabelWidth_Car;
    int m_nStatLabelHeight;
    int m_nStatLabelStartY;
    int m_nStatLabelSpaceX;
    int m_nStatLabelSpaceY;
    void CombineTwoLabel(int row,int index1,int index2);
};

#endif // PAGEBRAKE_H
